﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using PublicCommon;
using T_Rbac.Read.APi.Application.Command.MenuesCommand;
using T_Rbac_Demain;

namespace T_Rbac.Read.APi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MenuesController : ControllerBase
    {
        private readonly IMediator mediator;

        public MenuesController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取菜单下来列表
        /// </summary>
        /// <param name="menuesSearchByPidCommand"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<PublicTree<Menues>>> GetMenuesTress([FromQuery]MenuesSearchByPidCommand menuesSearchByPidCommand)
        {
            return await mediator.Send(menuesSearchByPidCommand);
        }
    }
}
